/* 移除背景图片样式 */
/* body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    margin: 0;
    padding: 0;
    color: #2d3748;
    min-height: 100vh;
    position: relative;
    display: flex;
} */
.background-container {
    display: none; /* 隐藏背景容器 */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
}
.background-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    opacity: 0;
    transition: opacity 2s ease-in-out;
}
#bg1 { background-image: url('https://images.unsplash.com/photo-1600585154340-be6161a56a0c?fit=crop&w=3840&q=100'); }
#bg2 { background-image: url('https://images.unsplash.com/photo-1469474968028-56623f02e42e?fit=crop&w=3840&q=100'); }
#bg3 { background-image: url('https://images.unsplash.com/photo-1441974231531-c6227db76b6e?fit=crop&w=3840&q=100'); }
.background-layer.active { opacity: 1; }
.container {
    flex: 1;
    margin-left: 240px; /* 调整为与导航栏宽度一致 */
    background: #ffffff;
    min-height: 100vh;
    position: relative;
    overflow-y: auto;
    display: flex;
    justify-content: center;
}
.toolbar {
    position: fixed;
    top: 0;
    right: 0;
    padding: 8px 16px;
    background: transparent;
    z-index: 100;
}
.toolbar button {
    padding: 8px 16px;
    border: none;
    background: #edf2f7;
    color: #4a5568;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.toolbar button:hover {
    background: #e2e8f0;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}
.toolbar button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.editor-container {
    width: 50%;
    margin: 0 auto;
    padding: 40px;
    min-height: calc(100vh - 80px);
    max-width: 800px;
    background-color: #ffffff; /* 默认白色背景 */
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    transition: background-color 0.3s ease;
}
#editor {
    width: 100%;
    padding: 0;
    background: transparent;
    border: none;
    outline: none;
    cursor: default;
    position: relative;
    overflow-y: visible;
    font-family: SimSun, "宋体", serif;
    font-size: 18px;
    color: #000000;
    margin: 0 auto;
    user-select: auto;
    -webkit-user-select: auto;
}
#editor:focus {
    border-color: #4299e1;
}
#editor:empty:before {
    content: none;
}
/* AI 输入框 */
.ai-input-container {
    margin: 12px 0;
    position: relative;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
    opacity: 0;
    transform: translateY(10px);
    animation: fadeInUp 0.3s forwards;
    padding: 4px;
    border: 1px solid #e1e4e8;
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ai-input-container.active {
    display: block;
}

.ai-input-wrapper {
    display: flex;
    flex-direction: column;
    background: #f7f9fc;
    border-radius: 10px;
    padding: 8px;
}

.ai-input {
    border: none;
    background: white;
    border-radius: 8px;
    padding: 10px 14px;
    min-height: 36px;
    max-height: 150px;
    width: 100%;
    font-size: 15px;
    line-height: 1.5;
    resize: none;
    color: #333;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
    margin-bottom: 8px;
    border: 1px solid #e1e4e8;
}

.ai-input:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(79, 114, 240, 0.3);
    border-color: #4f72f0;
}

.input-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 4px;
}

.model-select {
    flex: 1;
    margin-right: 10px;
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid #e1e4e8;
    font-size: 14px;
    background: linear-gradient(to bottom, #ffffff, #f5f7fa);
    color: #555;
    cursor: pointer;
    transition: all 0.2s;
    max-width: 180px;
}

.model-select:hover {
    border-color: #ccd0d5;
}

.ai-send {
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: linear-gradient(135deg, #4f72f0, #6755d3);
    color: white;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    min-width: 80px;
    height: 36px;
    transform: translateY(0);
    transition: all 0.2s ease;
    box-shadow: 
        0 2px 0 #3a54b4,
        0 3px 4px rgba(0, 0, 0, 0.1);
    user-select: none;
    position: relative;
    overflow: hidden;
}

.ai-send:hover {
    background: linear-gradient(135deg, #5a7cf7, #7262e2);
    transform: translateY(-1px);
    box-shadow: 
        0 3px 0 #3a54b4,
        0 4px 8px rgba(0, 0, 0, 0.15);
}

.ai-send:active {
    transform: translateY(1px);
    background: linear-gradient(135deg, #3d5bd3, #5745c0);
    box-shadow: 
        0 1px 0 #3a54b4,
        0 2px 3px rgba(0, 0, 0, 0.1);
}

.ai-send .button-text {
    position: relative;
    z-index: 1;
}

.ai-send:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 100%;
    background: rgba(255, 255, 255, 0.1);
    transition: width 0.2s ease;
}

.ai-send:hover:before {
    width: 100%;
}

.ai-send.active {
    opacity: 1;
}

.ai-send.active:before {
    content: "";
}

.ai-response {
    margin-top: 8px;
    padding: 0 12px;
    height: 0;
    overflow: hidden;
    transition: height 0.3s ease;
}

.ai-response:not(:empty) {
    height: auto;
    padding: 12px;
    border-top: 1px solid #f0f0f0;
}

.ai-reasoning, .ai-answer {
    margin: 8px 0;
    line-height: 1.6;
}

.ai-reasoning {
    color: #6b7280;
}

.reasoning-content, .answer-content {
    padding: 12px;
    border-radius: 8px;
    background-color: #f9fafb;
    border-left: 3px solid #e5e7eb;
    margin-top: 6px;
    font-size: 14px;
    overflow-x: auto;
}

.reasoning-content {
    background-color: #f0f4f8;
    border-left-color: #a3bffa;
    color: #4a5568;
    font-family: monospace;
    white-space: pre-wrap;
}

.ai-response-buttons {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    justify-content: flex-end;
}

.ai-response-buttons button {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s;
}

.ai-response-buttons button[data-action="accept"] {
    background-color: #34d399;
    color: white;
}

.ai-response-buttons button[data-action="accept"]:hover {
    background-color: #10b981;
}

.ai-response-buttons button[data-action="reject"] {
    background-color: #f87171;
    color: white;
}

.ai-response-buttons button[data-action="reject"]:hover {
    background-color: #ef4444;
}

/* AI问答样式 */
.ai-question, .ai-answer {
    margin: 12px 0;
    padding: 0;
    border-radius: 10px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.ai-question {
    background-color: #f0f7ff;
    border-left: 3px solid #3b82f6;
    padding: 12px 16px;
}

.ai-answer {
    background-color: #f7f7f7;
    border-left: 3px solid #6366f1;
    padding: 12px 16px;
    margin-bottom: 24px;
}

/* 加载指示器 */
.loading-indicator {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px 0;
    height: 40px;
}

.loading-indicator span {
    display: inline-block;
    width: 10px;
    height: 10px;
    margin: 0 5px;
    background: #5a7cf7;
    border-radius: 50%;
    animation: pulse 1.4s infinite ease-in-out both;
}

.loading-indicator span:nth-child(1) {
    animation-delay: -0.32s;
}

.loading-indicator span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes pulse {
    0%, 80%, 100% { 
        transform: scale(0.4);
        opacity: 0.3;
    }
    40% { 
        transform: scale(1.0);
        opacity: 1;
    }
}

/* 错误消息样式 */
.error-message {
    padding: 15px;
    margin: 10px 0;
    border-radius: 8px;
    background-color: #fee2e2;
    border-left: 4px solid #ef4444;
    color: #991b1b;
    font-size: 14px;
    line-height: 1.6;
}

.error-message strong {
    display: block;
    margin-bottom: 5px;
    font-size: 16px;
}

.error-message .error-help {
    margin-top: 10px;
    padding: 10px;
    background-color: rgba(255, 255, 255, 0.5);
    border-radius: 6px;
}

.error-message .error-help p {
    margin: 5px 0;
}

.error-message .error-help ul {
    margin: 5px 0;
    padding-left: 20px;
}

.error-message .error-help a {
    color: #3b82f6;
    text-decoration: none;
    font-weight: 500;
}

.error-message .error-help a:hover {
    text-decoration: underline;
}

h1 { font-size: 28px; margin: 12px 0; color: #2d3748; }
b { color: #1a202c; }
i { color: #4a5568; }
/* 编辑器内所有元素的基础样式 */
#editor p,
#editor div {
    margin: 0;
    line-height: 1.2; /* 保持较小的行高 */
}
/* 添加自定义滚动条样式 */
#editor::-webkit-scrollbar {
    width: 8px;
}

#editor::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

#editor::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

#editor::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}
.ai-response-content {
    white-space: normal;
    line-height: 1.5;
}
/* 修改图片调整大小控件样式 */
.image-resize-handle {
    position: absolute;
    width: 4px;
    height: 40px; /* 减小手柄高度 */
    background: rgba(0, 0, 0, 0.5);
    cursor: ew-resize;
    opacity: 0;
    transition: opacity 0.2s;
    top: 50%; /* 垂直居中 */
    transform: translateY(-50%); /* 确保完全居中 */
    border-radius: 2px; /* 添加圆角 */
}

.image-resize-handle.left {
    left: -2px; /* 稍微向外偏移 */
}

.image-resize-handle.right {
    right: -2px; /* 稍微向外偏移 */
}

.image-wrapper {
    position: relative;
    display: block;
    margin: 0;
    width: 100%;
    height: auto;
    overflow: hidden;
}

.image-wrapper:hover .image-resize-handle {
    opacity: 1;
}

.image-wrapper img {
    width: 100%;
    height: auto;
    object-fit: contain;
    display: block;
    margin: 0;
}

/* 添加图片拖动时的样式 */
.image-wrapper.resizing {
    user-select: none;
}

.image-wrapper.resizing .image-resize-handle {
    opacity: 1;
}

/* 修改块的基础样式 */
.block {
    width: 100%;
    margin: 3px 0; /* 进一步减少块之间的间距 */
    position: relative;
    min-height: 18px; /* 进一步减少最小高度 */
    padding: 1px 0; /* 减少内边距 */
    border-radius: 3px;
    transition: background-color 0.2s;
    box-sizing: border-box;
}

.block:hover .block-drag-handle {
    opacity: 1;
}

/* 修改拖动手柄样式 */
.block-drag-handle {
    position: absolute;
    left: -24px;
    top: 50%; /* 改为垂直居中定位 */
    transform: translateY(-50%); /* 垂直偏移自身高度50% */
    width: 20px;
    height: 20px;
    cursor: move;
    opacity: 0;
    transition: opacity 0.2s;
    background: url('data:image/svg+xml;utf8,<svg ... />') no-repeat center; /* 保持原有图标 */
}

/* 当块被悬停时显示拖动手柄 */
.block:hover .block-drag-handle {
    opacity: 1;
}

/* 新增拖动占位符样式 */
.block-placeholder {
    height: 2px;
    background: #4299e1;
    margin: 4px 0;
    opacity: 0;
    transition: opacity 0.2s;
}
.block-placeholder.visible {
    opacity: 1;
}

/* 修改文本块样式 */
.text-block {
    cursor: text;
    width: calc(100% - 24px);
    margin-left: 24px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    outline: none;
    position: relative;
    min-height: 18px; /* 进一步减少最小高度 */
    line-height: 1.2; /* 进一步减少行高 */
}

/* 修改拖动时的样式 */
.block.dragging {
    opacity: 0.5;
    background-color: rgba(66, 153, 225, 0.1);
    user-select: none;
}

/* 标题样式 */
.block.h1 {
    margin-top: 1.5rem; /* 减少顶部间距 */
    margin-bottom: 0.8rem; /* 减少底部间距 */
    min-height: 36px; /* 减少最小高度 */
}

.block.h1 .text-block {
    font-size: 2em;
    font-weight: bold;
    line-height: 1.2; /* 添加行高控制 */
}

.block.h2 {
    margin-top: 1.2rem; /* 减少顶部间距 */
    margin-bottom: 0.6rem; /* 减少底部间距 */
    min-height: 30px; /* 减少最小高度 */
}

.block.h2 .text-block {
    font-size: 1.5em;
    font-weight: bold;
    line-height: 1.2; /* 添加行高控制 */
}

/* 图片块样式 */
.image-block {
    position: relative;
    overflow: hidden;
    background: transparent;
    margin: 1rem auto;
    width: 100%;
    max-width: calc(71.4% - 250px); /* 调整图片块最大宽度 */
}

/* 左侧书签面板 */
.side-navigation {
    width: 240px;
    background-color: #fff; /* 添加背景色 */
    border-right: 1px solid #e3e3e3;
    height: 100vh;
    display: flex !important; /* 强制显示 */
    flex-direction: column;
    flex-shrink: 0;
    overflow-y: auto;
    z-index: 20; /* 确保层级高于其他元素 */
    position: fixed; /* 固定定位 */
    left: 0;
    top: 0;
}

/* 书签面板标题 */
.sidebar-title {
    padding: 0 20px;
    margin-bottom: 20px;
    font-size: 16px;
    color: #666;
}

/* 修改拖动指示线样式 */
.drag-indicator {
    position: absolute;
    height: 2px;
    background-color: #4299e1;
    width: calc(71.4% - 250px);
    left: calc(250px + (100% - 250px) * 0.143);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 1000;
}

/* 添加拖动目标位置样式 */
.block-drop-target {
    border-top: 2px solid #4299e1;
    margin-top: -1px;
    transition: border-top-color 0.2s;
}

/* 书签照片面板样式 */
.bookmark-panel {
    position: fixed;
    left: 0;
    top: 0;
    width: 250px;
    height: 100vh;
    padding: 16px;
    background: #f8fafc;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    overflow-y: auto;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
}

.bookmark-photo {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.bookmark-photo:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.bookmark-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 添加新页面标题样式 */
.editor-container::before {
    content: "新页面";
    display: block;
    position: absolute;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 48px;
    color: rgba(160, 174, 192, 0.3);
    pointer-events: none;
    z-index: -1;
    transition: opacity 0.3s ease;
}

/* 当有内容时隐藏标题 */
.editor-container:not(:empty)::before {
    opacity: 0;
}

/* 修改标题行样式 */
.title-block {
    font-size: 36px;
    text-align: center;
    margin: 40px 0 16px; /* 减少上下间距 */
    cursor: text;
    color: #2d3748; /* 改为正常颜色 */
    position: relative;
    outline: none;
    display: block;
    width: 100%;
    padding: 0 20px;
    box-sizing: border-box;
    opacity: 1 !important; /* 强制不透明 */
    user-select: text !important;
    -webkit-user-select: text !important;
    line-height: 1.2; /* 控制行高 */
}

/* 移除所有透明度相关样式 */
.title-block[data-modified="true"],
.title-block:focus {
    color: #2d3748;
}

/* 聚焦时保持可见 */
.title-block:focus {
    opacity: 1 !important;
    color: #2d3748 !important;
}

.title-block * {
    user-select: text !important;
    -webkit-user-select: text !important;
}

/* 添加块点击外框效果 */
.block:focus {
    outline: 2px solid rgba(66, 153, 225, 0.2);
    border-radius: 4px;
}

/* 为可聚焦元素添加指针样式 */
.block {
    cursor: pointer;
    transition: outline 0.1s ease;
}

/* 确保块元素可聚焦 */
.block[tabindex]:focus {
    outline: 2px solid rgba(66, 153, 225, 0.2);
    outline-offset: 2px;
}

/* 调整AI对话行距 */
.ai-question p,
.ai-answer p {
    line-height: 1.6 !important;
    margin: 4px 0 !important;
}

/* 移除最后一个段落的底部间距 */
.ai-question p:last-child,
.ai-answer p:last-child {
    margin-bottom: 0 !important;
}

/* 颜色选择器样式 */
.color-picker {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    padding: 8px;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    z-index: 1000;
    margin-top: 4px;
}

.color-option {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    cursor: pointer;
    border: 1px solid #e2e8f0;
    transition: transform 0.2s;
}

.color-option:hover {
    transform: scale(1.1);
}

.input-buttons {
    display: flex;
    align-items: center;
}

.ai-input {
    flex: 1;
    min-height: 24px;
    max-height: 72px;
    padding: 4px 8px;
    border: none;
    outline: none;
    resize: none;
    font-size: 14px;
    line-height: 1.5;
    color: #2d3748;
    background: transparent;
}

/* 图片右键菜单样式 */
.image-context-menu {
    position: fixed;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 4px 0;
    z-index: 1000;
    min-width: 120px;
}

.image-context-menu .menu-item {
    padding: 8px 12px;
    cursor: pointer;
    transition: background-color 0.2s;
    font-size: 14px;
    color: #4a5568;
}

.image-context-menu .menu-item:hover {
    background-color: #f7fafc;
    color: #4299e1;
}

/* Toast通知 */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    max-width: 350px;
    background: white;
    color: #333;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    font-size: 14px;
    transform: translateY(-20px);
    opacity: 0;
    transition: all 0.3s ease;
    border-left: 4px solid #4f72f0;
}

.toast.error {
    border-left-color: #ef4444;
    background-color: #fee2e2;
}

.toast.success {
    border-left-color: #10b981;
    background-color: #ecfdf5;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

/* 修改图片块样式，确保与其他块一致 */
.image-block.block {
    display: flex;
    align-items: flex-start;
    position: relative;
    margin: 3px 0;
    min-height: 18px;
    padding: 1px 0;
    border-radius: 3px;
    transition: background-color 0.2s;
}

.image-block.block .image-wrapper {
    flex: 1;
    margin-left: 24px; /* 与文本块保持一致的左边距 */
}

.image-block.block.dragging {
    opacity: 0.5;
    background-color: rgba(66, 153, 225, 0.1);
    user-select: none;
}

/* 确保图片块中的拖动手柄位置正确 */
.image-block.block .block-drag-handle {
    position: absolute;
    left: -24px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    cursor: move;
    opacity: 0;
    transition: opacity 0.2s;
}

.image-block.block:hover .block-drag-handle {
    opacity: 1;
}

/* 流式响应样式 */
.ai-loading {
    padding: 12px;
    background-color: #f8fafc;
    border-radius: 8px;
    margin-top: 8px;
}

.partial-response {
    margin-top: 12px;
    line-height: 1.6;
    color: #333;
    max-height: 300px;
    overflow-y: auto;
    font-size: 15px;
    padding: 10px;
    background-color: #fff;
    border-radius: 6px;
    border-left: 3px solid #6366f1;
} 